import i18n from '@/i18n'
import { Toast } from 'vant';

// base64图片下载到相册
export const saveBasePic = function(image,imageName){   
    let b = new plus.nativeObj.Bitmap();  
    b.loadBase64Data(image,function(){  
        b.save("_www/"+imageName,{overwrite:true},function(){  
            plus.gallery.save("_www/"+imageName, function () {  
                Toast({message:i18n.t('保存图片到相册成功'),className:'maxZindex'});
            },function(){  
                Toast({message:i18n.t('保存图片到相册失败'),className:'maxZindex'});
            });                   
        },function(){  
            Toast({message:i18n.t('保存图片失败！'),className:'maxZindex'});
        });               
    },function(){  
        Toast({message:i18n.t('写入文件失败，确认APP是否具有权限！'),className:'maxZindex'});
    });  
};